<template>
    <div>
        <a-modal
        title="选择人员"
        :visible="visible"
        @ok="handleOk"
        @cancel="handleCancel"
        :width="800"
        >
            <div class="reimbursement-selectPersonnel-box" v-if="visible">
                <commpVxeTable
                :key="dataTableKey"
                :config="dataTableConfig"
                :columns="columnsVxe"
                :formItem="formItem"
                :conditionBtnRow="true"
                ref="acceptanceRegistrationRef"
                @checkboxChange="selectedRowKeysChange"
                @searchEvent="searchEvent"
                @resetEvent="resetEvent"
                :isCanWrap="true"
                :selectItem="selectItem"
                >
                    <template v-slot:sex_default="{row}">
                        <span>{{ row.sex == 1?'男':'女' }}</span>
                    </template>
                    <template v-slot:realname_name="{row}">
                        <!-- <a @click="viewClick(row,true)"> -->
                            <span style="padding-right: 21;" v-if="row.realname && row.realname.length == 2">
                                <span v-for="(trem,tI) in row.realname.split('')" :key="tI" >
                                    {{trem}}
                                <span v-if="tI+1 !== row.realname.split('').length">&nbsp;&nbsp;</span>
                                </span>
                            </span>
                            <span style="padding-right: 21;" v-else>{{ row.realname }}</span>
                        <!-- </a> -->
                    </template>
                    <template v-slot:fgzdw_orgName="{row}">
                        {{ row.fgzdw }}/{{ row.fgzdwbm }}
                    </template>
                    <template v-slot:status_name="{row}">
                        {{ row.status == 1?'正常':'冻结' }}
                    </template>
                </commpVxeTable>
            </div>
        </a-modal>
    </div>
</template>
<script>
import compSelector from '@/components/compSelector/compSelector.vue'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import {jcyfybxdsaveSelectBxry,} from './service/index'
import moment from 'moment'
import assessCheckApi from './service/api'
export default {
    components:{
        compSelector,
        commpVxeTable,
    },
    props:{

    },
    data(){
        return{
            visible:false,
            nxData:{
                gznxks:'',
                gznxjs:'',
            },
            category:[],
            dataTableKey:null,
            addEditParameter:{},
            formItem:[],//
            columnsVxe:[{
                type: 'checkbox',
                width: 60 ,
                fixed: 'left'
            },{
                title: '姓名', //列头显示文字
                field: 'realname',
                slots: {
                    header:'realname_header',
                    default: 'realname_name'
                },
                titleInterval:true,
                width:90,
            },{
                title: '性别', //列头显示文字
                field: 'sex',
                titleInterval:true,
                slots: {
                    header:'sex_header',
                    default:'sex_default',
                },
                width:70,
            },{
                title: '工作单位',
                field: 'fgzdw',

            },{
                title: '审评身份', //列头显示文字
                field: 'fjcsf',
                width:92,
            }],
            dataTableConfig:{
                api: assessCheckApi.jcyfybxdqueryFybxdSqryList,
                rowId: 'id',
                autoHidden:true,
                // height:window.innerHeight - 245,
                height:window.innerHeight - 500,
                pageSize:10000,
                urlType: true,
                paramet:{

                }
            },
            selectedRowKeysArrId:[],
            selectedRowKeysArrName:[],
            searchFrom:{},
            formState:{},
            selectItem:{},
        }
    },
    watch:{

    },
    mounted(){


    },
    methods:{
        getData(row){
            this.formState = row
            this.dataTableConfig.paramet = {...row,idArr:''}
            this.selectItem = {
                selectArr:row.idArr,
                key:'id',
            }
            this.dataTableKey = Date.now()
        },
        selectedRowKeysChange(row){
            this.selectedRowKeysArrId = []
            this.selectedRowKeysArrName = []
            row.forEach(item => {
                this.selectedRowKeysArrId.push(item.id)
                this.selectedRowKeysArrName.push(item.realname)
            });
        },
        searchEvent(){
        },
        resetEvent(){
        },
        handleOk(){
            if(this.selectedRowKeysArrId.length){
                this.$emit('getApplicantData',{id:this.selectedRowKeysArrId.join(','),name:this.selectedRowKeysArrName.join(','),val:this.formState.val})
                this.visible = false
            }else{
                this.$message.warning('请选择人员')
            }
        },
        handleCancel(){
            this.visible = false
        }
    }
}
</script>
<style lang="less">
.reimbursement-selectPersonnel-box{

}
.full-modal-selectPersonnel{
    .ant-modal {
        max-width: 100%;
        top: 0;
        padding-bottom: 0;
        margin: 0;
    }
    .ant-modal-content {
        display: flex;
        flex-direction: column;
        height: calc(100vh);
    }
    .ant-modal-body {
        flex: 1;
        padding:8px 0;
    }
}
</style>
